unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IteratorImpl;

type
  TMainForm = class(TForm)
    GroupBox1: TGroupBox;
    Button1: TButton;
    Memo: TMemo;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    StrArray  : array of String;
    Itr       : TIteratorImpl;
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

procedure TMainForm.Button1Click(Sender: TObject);
begin
  while Itr.HasNext do
  begin
    Memo.Lines.Add(String(Itr.Next));
  end;
end;

procedure TMainForm.Button2Click(Sender: TObject);
begin
  Memo.Lines.Add(String(Itr.Next));
end;

procedure TMainForm.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  SetLength(StrArray, 10);
  for I := 0 to 9 do
    StrArray[I] := IntToStr(I);

  Itr := TIteratorImpl.Create(TObject(StrArray));
end;

end.
